package com.zou.study.zmy;

import org.apache.tomcat.util.collections.SynchronizedQueue;

import java.util.concurrent.SynchronousQueue;

/**
 * TODO 描述
 * <br/>Date 2021/8/24
 * <br/>Time 18:44:30
 *
 * @author _blank
 */
public class SynchronizedQueueTests {

    public static void main(String[] args) {

        // 这个是juc下面的queue
        final SynchronousQueue<String> synchronousQueue = new SynchronousQueue<>();
        for (int i = 0; i < 256; i++) {
            synchronousQueue.offer("zjx" + i);
        }

        System.out.println(synchronousQueue.size());


        // 这个是tomcat的queue
        final SynchronizedQueue<Object> queue = new SynchronizedQueue<>();

        for (int i = 0; i < 256; i++) {
            queue.offer("zjx" + i);
        }

        System.out.println(queue.size());
    }

}
